package com.liqi.frame.comm.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Objects;

/**
 * 权限工具类
 * Created by liqi on 2018/2/5.
 * liqiwork@qq.com
 */
@Component
public class PermissionUtil {
    private static String administrator;

    @Value("${app.permission.administrator}")
    public void setAdministrator(String administrator){
        PermissionUtil.administrator = administrator;
    }

    /**
     * 判断是否是系统管理员
     * @param pending 用户名
     * @return 结果
     */
    public final static boolean judgeAdministrator(String pending) {
        if ( Objects.equals(administrator.trim(), pending.trim()) ) {
            return true;
        }
        return false;
    }
}
